**//Duration model
clear
set more off
use "C:\Users\Samangi\Documents\CBJ paper\Data.dta"
xtset ID Year
by ID: gen lagGDP= GDPgrowthannual[_n-1]
by ID: gen Creditgrowth = Domesticcredittoprivatesecto/ GDPdeflatorbaseyearvariesb
by ID: gen inflation = (GDPdeflatorbaseyearvariesb/ L.GDPdeflatorbaseyearvariesb -1)*100
by ID: gen tot = ( Netbartertermsoftradeindex / L.Netbartertermsoftradeindex -1)*100
gen concentration = Bankconcentration / 100

gen Yearr = Year
snapspan ID Year Crisis , gen(Year0) replace
rename Year Year1
gen Year = Yearr

stset Year1 , origin(time Year0) id(ID) failure(Crisis) exit(time .)   

streg lagGDP inflation  Realinterestrate tot Creditgrowth  MoralHazard  ///
German French English Scandinavian African Other LA Lernerindex, dist(exponential) nohr ///
robust cluster(ID) time

streg lagGDP inflation  Realinterestrate tot Creditgrowth  MoralHazard  ///
German French English Scandinavian African Other LA Lernerindex concentration, dist(exponential) nohr ///
robust cluster(ID) time

streg lagGDP inflation  Realinterestrate tot Creditgrowth  MoralHazard  ///
German French English Scandinavian African Other LA Booneindicator, dist(exponential) nohr ///
robust cluster(ID) time

streg lagGDP inflation  Realinterestrate tot Creditgrowth  MoralHazard  ///
German French English Scandinavian African Other LA Booneindicator concentration, dist(exponential) nohr ///
robust cluster(ID) time


**//logit model
clear
set more off
use "C:\Users\Samangi\Documents\CBJ paper\Data.dta"
xtset ID Year
by ID: gen lagGDP= GDPgrowthannual[_n-1]
by ID: gen Creditgrowth = Domesticcredittoprivatesecto/ GDPdeflatorbaseyearvariesb
by ID: gen inflation = (GDPdeflatorbaseyearvariesb/ L.GDPdeflatorbaseyearvariesb -1)*100
by ID: gen tot = ( Netbartertermsoftradeindex / L.Netbartertermsoftradeindex -1)*100
gen concentration = Bankconcentration / 100
logit Crisis  lagGDP inflation  Realinterestrate tot Creditgrowth  MoralHazard  ///
German French English Scandinavian African Other LA Lernerindex, robust

logit Crisis  lagGDP inflation  Realinterestrate tot Creditgrowth  MoralHazard  ///
German French English Scandinavian African Other LA Lernerindex concentration, robust

logit Crisis lagGDP inflation  Realinterestrate tot Creditgrowth  MoralHazard  ///
German French English Scandinavian African Other LA Booneindicator, robust

logit Crisis lagGDP inflation  Realinterestrate tot Creditgrowth  MoralHazard  ///
German French English Scandinavian African Other LA Booneindicator concentration, robust


**//fractional logistic
clear
set more off
use "C:\Users\Samangi\Documents\CBJ paper\Data.dta"
xtset ID Year
by ID: gen lagGDP= GDPgrowthannual[_n-1]
by ID: gen Creditgrowth = Domesticcredittoprivatesecto/ GDPdeflatorbaseyearvariesb
by ID: gen inflation = (GDPdeflatorbaseyearvariesb/ L.GDPdeflatorbaseyearvariesb -1)*100
by ID: gen tot = ( Netbartertermsoftradeindex / L.Netbartertermsoftradeindex -1)*100
gen concentration = Bankconcentration / 100
gen Z = BankZscore / 100
drop if Z<0

glm Z lagGDP inflation  Realinterestrate tot Creditgrowth  MoralHazard  ///
German French English Scandinavian African Other LA ///
Lernerindex,family(binomial) link(logit) vce(robust) nolog

glm Z lagGDP inflation  Realinterestrate tot Creditgrowth  MoralHazard  ///
German French English Scandinavian African Other LA Lernerindex ///
concentration,family(binomial) link(logit) vce(robust) nolog

glm Z lagGDP inflation  Realinterestrate tot Creditgrowth  MoralHazard  ///
German French English Scandinavian African Other LA ///
Booneindicator,family(binomial) link(logit) vce(robust) nolog

glm Z lagGDP inflation  Realinterestrate tot Creditgrowth  MoralHazard  ///
German French English Scandinavian African Other LA Booneindicator ///
concentration,family(binomial) link(logit) vce(robust) nolog


